package mt.dummy;

import java.io.IOException;
import java.net.UnknownHostException;

import javax.swing.JOptionPane;

import mt.client.MicroTraderClient;
import mt.comm.ClientComm;

public class MicroTraderClientDummy implements MicroTraderClient {

	private String nickname;
	private static final String host = "localhost";
	private ClientComm clientComm;
	
	public MicroTraderClientDummy(String nickname) {
		this.nickname = nickname;
	}
	
	
	
	@Override
	public void start(ClientComm clientComm) {
		this.clientComm = clientComm; 
		try {
			clientComm.connect(host, nickname);
			
		} catch (UnknownHostException e) {
			JOptionPane.showMessageDialog(null, "Host cannot be found!", "UnknownHostException", JOptionPane.ERROR_MESSAGE);
			e.printStackTrace();
		} catch (IOException e) {
			JOptionPane.showMessageDialog(null, "Connection cannot be established!", "IOException", JOptionPane.ERROR_MESSAGE);
			e.printStackTrace();
		}
		
	}

}
